package com.lglbc.elasticsearch;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;

import java.util.Date;
import java.util.List;
@AllArgsConstructor
@NoArgsConstructor
public class OrderInfo {
    @JsonProperty("order_no")
    private String orderNo;
    @JsonProperty("order_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date orderTime;
    @JsonProperty("good_info")
    private List<GoodInfo> goodInfo;
    @JsonProperty("buyer")
    private String buyer;
    @JsonProperty("phone")
    private String phone;
@NoArgsConstructor
    public static class GoodInfo{
        @JsonProperty("good_name")
        private String goodName;
        @JsonProperty("good_price")
        private double goodPrice;
        @JsonProperty("good_count")
        private int goodCount;

        public GoodInfo(String goodName, double goodPrice, int goodCount) {
            this.goodName = goodName;
            this.goodPrice = goodPrice;
            this.goodCount = goodCount;
        }

        public String getGoodName() {
            return goodName;
        }

        public void setGoodName(String goodName) {
            this.goodName = goodName;
        }

        public double getGoodPrice() {
            return goodPrice;
        }

        public void setGoodPrice(double goodPrice) {
            this.goodPrice = goodPrice;
        }

        public int getGoodCount() {
            return goodCount;
        }

        public void setGoodCount(int goodCount) {
            this.goodCount = goodCount;
        }
    }

    public List<GoodInfo> getGoodInfo() {
        return goodInfo;
    }

    public void setGoodInfo(List<GoodInfo> goodInfo) {
        this.goodInfo = goodInfo;
    }

    public String getOrderNo() {
        return orderNo;
    }

    public void setOrderNo(String orderNo) {
        this.orderNo = orderNo;
    }

    public Date getOrderTime() {
        return orderTime;
    }

    public void setOrderTime(Date orderTime) {
        this.orderTime = orderTime;
    }

    public String getBuyer() {
        return buyer;
    }

    public void setBuyer(String buyer) {
        this.buyer = buyer;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public OrderInfo(String orderNo, Date orderTime, String buyer, String phone) {
        this.orderNo = orderNo;
        this.orderTime = orderTime;
        this.buyer = buyer;
        this.phone = phone;
    }
}
